-
Notifications
You must be signed in to change notification settings - Fork 178
Perform RexNode expression standardization for script push down. #4795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Perform RexNode expression standardization for script push down. #4795
Conversation
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
…ardization # Conflicts: # integ-test/src/test/java/org/opensearch/sql/calcite/remote/CalciteExplainIT.java # integ-test/src/test/resources/expectedOutput/calcite/explain_agg_script_udt_arg_push.yaml # integ-test/src/test/resources/expectedOutput/calcite/explain_regexp_match_in_where.json # opensearch/src/main/java/org/opensearch/sql/opensearch/storage/scan/context/PushDownContext.java
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
...c/main/java/org/opensearch/sql/opensearch/storage/scan/context/AggregationBuilderAction.java
Show resolved
Hide resolved
...search/src/main/java/org/opensearch/sql/opensearch/storage/scan/context/PushDownContext.java
Show resolved
Hide resolved
opensearch/src/main/java/org/opensearch/sql/opensearch/storage/script/CalciteScriptEngine.java
Outdated
Show resolved
Hide resolved
| return switch (sources.get(index)) { | ||
| case DOC_VALUE -> getFromDocValue((String) digests.get(index)); | ||
| case SOURCE -> getFromSource((String) digests.get(index)); | ||
| case LITERAL -> getFromLiteral((Integer) digests.get(index)); | ||
| }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could u add a developer doc to explain the spec of pushdown script, after encoding, is not easy to read I guess.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added in 1278054
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. It is very clear.
Nit: Is Literals array necessary? DIGESTS and LITERALS can combined?
"params": {
"utcTimestamp": 17630261838681530000,
"SOURCES": [0, 2, 2, 1],
"DIGESTS": ["age", 0, 1, "email"],
"LITERALS": [35, "u35"]
}
vs
"params": {
"utcTimestamp": 17630261838681530000,
"SOURCES": [0, 2, 2, 1],
"DIGESTS": ["age", 35, "u35", "email"]
}
opensearch/src/main/java/org/opensearch/sql/opensearch/storage/script/CalciteScriptEngine.java
Show resolved
Hide resolved
opensearch/src/main/java/org/opensearch/sql/opensearch/util/OpenSearchRelOptUtil.java
Show resolved
Hide resolved
Signed-off-by: Heng Qian <[email protected]>
…ardization # Conflicts: # integ-test/src/test/resources/expectedOutput/calcite/explain_eval_min.yaml # integ-test/src/test/resources/expectedOutput/calcite_no_pushdown/explain_eval_min.yaml
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
Signed-off-by: Heng Qian <[email protected]>
| SerializationWrapper.wrapWithLangType( | ||
| ScriptEngineType.CALCITE, serializer.serialize(rexNode, rowType, fieldTypes)); | ||
| ScriptEngineType.CALCITE, | ||
| serializer.serialize(rexNode, rowType, fieldTypes, sources, digests, literals)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why include sources, digests, literals as paramater in serialize() function and client create empty array?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see. It is required when create Script on L1504.
I also found sources, digests, literals exposed been used in multiple place without encapsulation. e.g. ScriptDataContext and standardizeRexNodeExpression.
can we encapsulate our script protocol in a class? e.g.
class ParameterBindings {
void putValue(String name, Object value)
Object getValue(String name)
}
Description
This PR includes changes:
ROW_TYPEandEXPR_MAPin our script. Then the average script size can be reduced by 2 to 5 times than before.OpenSearchRequestBuilderwhen computing digest forOpenSearchIndexScanOperator, while keep it when generating explain plan.OpenSearchRequestBuilderinPushDownContextand make the related action lazy perform. Since we have change 3, it's less valuable to hold that object in eachPushDownContext.Related Issues
Partly resolves #4757
Check List
--signoffor-s.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.